/**
 * 
 */
package com.fly.sms.adapter;

import java.util.List;
import java.util.Map;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.fly.sms.CommonActivity;
import com.fly.sms.R;

public class SmsSendNumberListAdapter extends IAdapter {
	private List<Map<String, Object>> list=null;
	TextView Name;
	TextView DestNumber;
	ImageView SubmitResponseResultCode;
	TextView CreateTime;
	TextView LastSubmitTime;
	TextView MsgContent;
	TextView SMTaskId;

	public SmsSendNumberListAdapter(CommonActivity context,List<Map<String, Object>> list) {
		super(context);
		this.list=list;
	}

	public int getCount() {
		return  list.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView=context.getView(R.layout.smssendnumberlistitem);
			Name=(TextView)convertView.findViewById(R.id.Name);
			CreateTime=(TextView)convertView.findViewById(R.id.CreateTime);
			DestNumber=(TextView)convertView.findViewById(R.id.DestNumber);
			SubmitResponseResultCode=(ImageView)convertView.findViewById(R.id.SubmitResponseResultCode);
			LastSubmitTime=(TextView)convertView.findViewById(R.id.LastSubmitTime);
			MsgContent=(TextView)convertView.findViewById(R.id.MsgContent);
			SMTaskId=(TextView)convertView.findViewById(R.id.SMTaskId);
		}
		Map<String, Object> map=list.get(position);
		Name.setText(map.get("Name").toString());
		CreateTime.setText(map.get("CreateTime").toString());
		DestNumber.setText(map.get("DestNumber").toString());
		SubmitResponseResultCode.setBackgroundResource(R.drawable.success);
		LastSubmitTime.setText(map.get("LastSubmitTime").toString());
		MsgContent.setText(map.get("MsgContent").toString());
		SMTaskId.setText(map.get("SMTaskId").toString());
		return convertView;
	}
}
